//
//  ShareView.m
//  WULIHH
//
//  Created by Gamefire on 16/5/9.
//  Copyright © 2016年 tang. All rights reserved.
//

#import "ShareView.h"
#import "Header.h"
@interface ShareView (){

    UILabel *_titleLabel;
    UIButton *_circleOfFriendsButton;
    UIButton *_weChatButton;
    UIButton *_qqButton;
    UIButton *_sinaButton;
    
    UIButton *_toReportButton;
    UIButton *_cancelButton;
    
    UILabel *_circleOfFriendsLabel;
    UILabel *_weChatLabel;
    UILabel *_qqlabel;
    UILabel *_sinaLabel;
    
    UIView *_bottomView;
    UIView *_view;
    UIButton *_topButton;
}

@end

@implementation ShareView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        _topButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, WithView, heightView - 230)];
        [_topButton setBackgroundColor:[UIColor clearColor]];
        [_topButton addTarget:self action:@selector(TopTouchEvent) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_topButton];
        
        _view = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_topButton.frame), WithView, 230)];
        [_view setBackgroundColor:uicolor(247, 249, 249)];
        [self addSubview:_view];
        //   标题
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(WithView / 2.0 - 45, 11, 90, 16)];
//        [_titleLabel setBackgroundColor:[UIColor redColor]];
        [_titleLabel setText:@"分享这组作品"];
        [_titleLabel setFont:[UIFont systemFontOfSize:14.0]];
        [_view addSubview:_titleLabel];
        
        // 朋友圈
        _circleOfFriendsButton = [[UIButton alloc] initWithFrame:CGRectMake((WithView - 55.5 * 4)/5, CGRectGetMaxY(_titleLabel.frame)+16, 55.5, 55.5)];
//        [_circleOfFriendsButton setBackgroundColor:[UIColor greenColor]];
        [_circleOfFriendsButton.layer setCornerRadius:55.5 / 2.0];
        [_circleOfFriendsButton setBackgroundImage:[UIImage imageNamed:@"circleOfFriends"] forState:UIControlStateNormal];
        [_circleOfFriendsButton addTarget:self action:@selector(CircleOfFriend) forControlEvents:UIControlEventTouchUpInside];
        [_view addSubview:_circleOfFriendsButton];
        
        _circleOfFriendsLabel = [[UILabel alloc] initWithFrame:CGRectMake((WithView - 58*4)/5, CGRectGetMaxY(_circleOfFriendsButton.frame) + 8.0, 58, 15)];
//        [_circleOfFriendsLabel setBackgroundColor:[UIColor grayColor]];
        [_circleOfFriendsLabel setText:@"朋友圈"];
        [_circleOfFriendsLabel setTextAlignment:NSTextAlignmentCenter];
        [_circleOfFriendsLabel setFont:[UIFont systemFontOfSize:14.0]];
        [_circleOfFriendsLabel setTextColor:uicolor(155, 157, 158)];
        [_view addSubview:_circleOfFriendsLabel];
        
        // 微信
        _weChatButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_circleOfFriendsButton.frame) + (WithView - 55.5 * 4)/5, CGRectGetMaxY(_titleLabel.frame)+16, 55.5, 55.5)];
//        [_weChatButton setBackgroundColor:[UIColor greenColor]];
        [_weChatButton.layer setCornerRadius:55.5 / 2.0];
        [_weChatButton setBackgroundImage:[UIImage imageNamed:@"wechat"] forState:UIControlStateNormal];
        [_weChatButton addTarget:self action:@selector(WeChatTouchEvent) forControlEvents:UIControlEventTouchUpInside];
        [_view addSubview:_weChatButton];
        
        _weChatLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_circleOfFriendsLabel.frame) + (WithView - 58*4)/5, CGRectGetMaxY(_circleOfFriendsButton.frame) + 8.0, 58, 15)];
//        [_weChatLabel setBackgroundColor:[UIColor grayColor]];
        [_weChatLabel setText:@"微信好友"];
        [_weChatLabel setFont:[UIFont systemFontOfSize:14.0]];
        [_weChatLabel setTextColor:uicolor(155, 157, 158)];
        [_view addSubview:_weChatLabel];
       
        
        //QQ
        _qqButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_weChatButton.frame) + (WithView - 55.5 * 4)/5, CGRectGetMaxY(_titleLabel.frame)+16, 55.5, 55.5)];
//        [_qqButton setBackgroundColor:[UIColor blueColor]];
        [_qqButton.layer setCornerRadius:55.5 / 2.0];
        [_qqButton setBackgroundImage:[UIImage imageNamed:@"qq"] forState:UIControlStateNormal];
        [_qqButton addTarget:self action:@selector(QQTouchEvent) forControlEvents:UIControlEventTouchUpInside];
        [_view addSubview:_qqButton];
        
        _qqlabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_weChatLabel.frame) + (WithView - 58*4)/5, CGRectGetMaxY(_circleOfFriendsButton.frame) + 8.0, 58, 15)];
//        [_qqlabel setBackgroundColor:[UIColor grayColor]];
        [_qqlabel setText:@"QQ"];
        [_qqlabel setTextColor:uicolor(155, 157, 158)];
        [_qqlabel setFont:[UIFont systemFontOfSize:14.0]];
        [_qqlabel setTextAlignment:NSTextAlignmentCenter];
        [_view addSubview:_qqlabel];
        //新浪
        _sinaButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_qqButton.frame) + (WithView - 55.5 * 4)/5, CGRectGetMaxY(_titleLabel.frame)+16, 55.5, 55.5)];
//        [_sinaButton setBackgroundColor:[UIColor redColor]];
        [_sinaButton.layer setCornerRadius:55.5 / 2.0];
        [_sinaButton addTarget:self action:@selector(SinaTouchEvent) forControlEvents:UIControlEventTouchUpInside];
        [_sinaButton setBackgroundImage:[UIImage imageNamed:@"sina"] forState:UIControlStateNormal];
        [_view addSubview:_sinaButton];
        
        _sinaLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_qqlabel.frame) + (WithView - 58*4)/5, CGRectGetMaxY(_circleOfFriendsButton.frame) + 8.0, 58, 15)];
        [_sinaLabel setText:@"新浪微博"];
        [_sinaLabel setFont:[UIFont systemFontOfSize:14.0]];
        [_sinaLabel setTextColor:uicolor(155, 157, 158)];
//        [_sinaLabel setBackgroundColor:[UIColor grayColor]];
        [_view addSubview:_sinaLabel];
        
        //举报
        _toReportButton = [[UIButton alloc]initWithFrame:CGRectMake(20.0, CGRectGetMaxY(_sinaLabel.frame) + 20.0, WithView - 40, 35) ];
        [_toReportButton setTitle:@"举报" forState:UIControlStateNormal];
        [_toReportButton.titleLabel setFont:[UIFont systemFontOfSize:15.0]];
        [_toReportButton setBackgroundColor:uicolor(236, 236, 237)];
        [_toReportButton.layer setCornerRadius:5.0];
        [_toReportButton setTitleColor:uicolor(36, 36, 37) forState:UIControlStateNormal];
        [_toReportButton addTarget:self action:@selector(ToReportEvent) forControlEvents:UIControlEventTouchUpInside];
        [_view addSubview:_toReportButton];
        
        //取消
        _bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_toReportButton.frame) + 4.0, WithView, 49)];
        [_bottomView setBackgroundColor:[UIColor whiteColor]];
        [_view addSubview:_bottomView];
        
        _cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(20, 8, WithView - 40.0, 35)];
        [_cancelButton setBackgroundColor:uicolor(240, 204, 48)];
        [_cancelButton setTitle:@"取消" forState:UIControlStateNormal];
        [_cancelButton.titleLabel setFont:[UIFont systemFontOfSize:15.0]];
        [_cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_cancelButton.layer setCornerRadius:5.0];
        [_cancelButton addTarget:self action:@selector(cancelEvent) forControlEvents:UIControlEventTouchUpInside];
        [_bottomView addSubview:_cancelButton];
    }
    return self;
}

// 朋友圈的点击事件
- (void)CircleOfFriend{




}


// 微信的点击事件
- (void)WeChatTouchEvent{





}


// QQ的点击事件
- (void)QQTouchEvent{





}

// 新浪的点击事件
- (void)SinaTouchEvent{




}


//举报
- (void)ToReportEvent{




}


//取消
- (void)cancelEvent{
    
    if (_delegate && [_delegate respondsToSelector:@selector(TouchOfShrinkDown)]) {
        [_delegate TouchOfShrinkDown];
    }
    
}
- (void)TopTouchEvent{
   
    if (_delegate && [_delegate respondsToSelector:@selector(TouchOfShrinkDown)]) {
        [_delegate TouchOfShrinkDown];
    }

}
@end
